package com.example.testblog.service;

import com.example.testblog.Dao.TagsRepository;
import com.example.testblog.entity.Tag;
import com.example.testblog.entity.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TagsServiceImpl implements  TagsService {
       @Autowired
      private TagsRepository tagsRepository;


   @Transactional
    @Override
    public Page<Tag> listTags(Pageable pageable) {
        return  tagsRepository.findAll(pageable);
    }

    @Override
    public Tag saveTags(Tag tag) {
        return tagsRepository.save(tag);
    }

    @Override
    public void TagesDelete(Tag tag) {

       tagsRepository.delete(tag);
    }
}
